/*
 * Copyright 2011 Impetus Infotech.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.impetus.teamplan.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

import com.impetus.kundera.api.ColumnFamily;
import com.impetus.kundera.api.Document;

/**
 * <Provide Type description>
 * @author amresh.singh
 */
@Entity
@Document(name="Responsibilities", db="TeamPlans")
//@ColumnFamily(family="Responsibilities", keyspace="TeamPlans")
public class Responsibility implements Serializable {
	
	public Responsibility() {
		
	}
	
	public Responsibility(String responsibilityId, String responsibilityDescription) {
		this.responsibilityId = responsibilityId;
		this.responsibilityDescription = responsibilityDescription;
	}
	
	@Id
	@Column(name = "responsibility_id")
	String responsibilityId;
		
	@Column(name = "responsibilityDescription")
	String responsibilityDescription;

	public String getResponsibilityId() {
		return responsibilityId;
	}

	public void setResponsibilityId(String responsibilityId) {
		this.responsibilityId = responsibilityId;
	}

	public String getResponsibilityDescription() {
		return responsibilityDescription;
	}

	public void setResponsibilityDescription(String responsibilityDescription) {
		this.responsibilityDescription = responsibilityDescription;
	} 
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((responsibilityId == null) ? 0 : responsibilityId.hashCode());
		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof Responsibility))
            return false;
        Responsibility other = (Responsibility) obj;
        if (responsibilityId == null) {
            if (other.responsibilityId != null)
                return false;
        } else if (!responsibilityId.equals(other.responsibilityId))
            return false;
        return true;
	}
	
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("\n(");
		builder.append(responsibilityId);
		builder.append(") ");
		builder.append(responsibilityDescription);		
		return builder.toString();
	}

}
